package view;

import service.AdminService;
import service.StudentManagerService;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

//控制台界面
public class ConsoleView {
    StudentManagerService studentManagerService = new StudentManagerService();
    Scanner scanner = new Scanner(System.in);
    //登录界面
    //< >泛型
    public ArrayList<String> loginView(){
        //定义两个变量用来保存键盘输入的管理员账号密码
        String adminUsername;
        String adminPassword;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名:");
        adminUsername = scanner.nextLine();
        System.out.println("请输入密码：");
        adminPassword = scanner.nextLine();
        //新建一个ArrayList用来保存提交的用户名密码
        //模拟form表单提交
        ArrayList<String> form = new ArrayList<>();
        form.add(adminUsername);
        form.add(adminPassword);
        return form;
    }
    //操作菜单界面
    public int menuView(){
        System.out.println("===========");
        System.out.println("1.新增学生");
        System.out.println("2.删除学生");
        System.out.println("3.查找学生");
        System.out.println("4.修改学生");
        System.out.println("5.退出系统");
        System.out.println("===========");
        System.out.println("请选择序号：");
        int num = scanner.nextInt();
        return num;
    }
    //菜单选择错误信息提示
    public void errorInfoView(){
        System.out.println("你选择的菜单序号不对，请重新选择!");
    }
    //添加学生页面
    public void addStudentView(){
        System.out.println("====新增学生页面====");
        //    private String name;
        //    private int sid;
        //    private String sex;
        //    private int age;
        //    private double gpa;
        //    private int grade;
        //    private boolean inschool;
        //    private String phonenum;
        System.out.println("请输入学生姓名：");
        String name = scanner.nextLine();
        System.out.println("请输入学生学号：");
        int sid = scanner.nextInt();
        System.out.println("请输入学生性别：");
        String sex= scanner.nextLine();
        System.out.println("请输入学生年龄：");
        int age = scanner.nextInt();
        System.out.println("请输入学生平均成绩：");
        double gpa = scanner.nextDouble();
        System.out.println("请输入学生年级：");
        int grade = scanner.nextInt();
        System.out.println("学生是否在校：");
        boolean inschool = scanner.nextBoolean();
        System.out.println("请输入学生手机号：");
        String phonenum= scanner.nextLine();
        //调用service层的添加学生方法并传递页面获取的数据过去
        studentManagerService.addStudent(name,sid,sex,age,gpa,grade,inschool,phonenum);
    }
    //修改学生页面
    public void updateStudentView(){
        System.out.println("====修改学生页面====");
    }
    //删除学生页面
    public void deleteStudentView(){
        System.out.println("====删除学生页面====");
    }
    //查询学生页面
    public void selectStudentView(){
        System.out.println("====查询学生页面====");
    }
}
